<?php

/*

List Pets (listpets.php)

*/

$rank_check = 0;
$page_title = "List Pets";
include "header.inc.php";

if (!$start) { $start = 0; }
$max = 10;
$max2 = $start + $max;

$findPetList = mysql_query("SELECT * FROM pets2 WHERE game = '$game' ORDER BY id DESC LIMIT $start,$max");
$numPets2 = mysql_num_rows($findPetList);
$findPetList2 = mysql_query("SELECT * FROM pets2 WHERE game = '$game'");
$numPets = mysql_num_rows($findPetList2);
while ($getPetList = mysql_fetch_array($findPetList))
{
	if ($getPetList[pet_desc])
	{
		$petDesc = $getPetList[pet_desc];
	}
	else
	{
		$petDesc = "<i>no decription available for this pet :(";
	}
	
	$petList .= "<tr><td><p align=center><img src=images/user_images/opg_$game/pets/pet_$getPetList[id].gif border=1><br><b>$getPetList[name]</b></p></td><tr>
<tr><td><p><font size=-1><b>Description:</b> $petDesc</font></p></td></tr>";
}

ECHO <<<END

<HTML>
<HEAD>
<TITLE>$gameName2: $page_title</TITLE>
<script language="JavaScript">

function closeWindow(url)
{
   	window.close();
}
	
</script>

	<style><!--
	A:link {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	A:visited {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	A:hover {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	A:active {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	--></style>
	
</HEAD>
<BODY BGCOLOR="$reallyLight">

<p align=center>Showing you <b>$numPets2</b> of <b>$numPets</b> species.</p>

<center>
<table width=225>
<tr><td><p align=center><b><font size=+2>-- List Pets -- </b></font></td></tr>

$petList

</table>
</center>

END;

if (($numPets > $max) AND ($start < ($numPets - $max)))
{
	echo "<p align=center><a href=$base_url/listpets.php?game=$game&start=$max2>Next page</a></p>";
}
if ($start != 0)
{
	$prev_min = $start - $max;
	echo "<p align=center><a href=$base_url/listpets.php?game=$game&start=$prev_min>Previous page</a></p>";
}

print "<p align=center><input type=button name=closeWin value=\"Close Window\" onClick=\"javascript:closeWindow('');\"></p>";

?>
